<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="java.util.*"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
//response.sendRedirect("common/login");
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>索引</title>
			<script type="text/javascript" src="${path }/resource/js/jquery-2.0.3.js"></script>
			<script type="text/javascript" src="${path }/resource/layer/layer.js"></script>
			<script type="text/javascript" src="${path }/resource/js/mytools.js"></script>
			<link rel="stylesheet" href="${path }/resource/bootstrap/css/bootstrap.min.css" />
			<link rel="stylesheet" href="${path }/resource/bootstrap/css/bootstrap-responsive.min.css" />
	</head>
	<body>
	<br>
		<form onsubmit="return check()" action="${path }/developer/jiasnhu/search" method="post">
		<div class="input-prepend input-append">
		  	<span class="add-on">文章搜索：</span>
		  	<input type="text" class="span2"  name="title" id="searchText" value="${serchword}" /> 
			<input type="submit" class="btn btn-primary" value="搜索一下" >
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<span class="add-on">看看天气：</span>
	  	<input type="text" class="span2"  name="cityName" id="cityName" /> 
		<input type="button" class="btn btn-primary" value="查询天气" onclick="getWeather()" >
		<span class="add-on">号码归属地查询：</span>
	  	<input type="text" class="span2"  name="mobileCode" id="mobileCode" /> 
		<input type="button" class="btn btn-primary" value="查询" onclick="getMobileCode()" >
		</div>
		</form>
		<br>
		<div class="input-prepend input-append">
	  	
		</div>
		<div id="weatherContent"> 
		
		</div>
		
		<c:forEach items="${list}" var="word">
		<br>
		<a href="${path }/${word.link}">标题：${word.title}</a><br>
		摘要：${word.content}<br>
		<%-- ${word.content}<br> --%>
		</c:forEach>
		<script type="text/javascript">
		function check(){
			if($("#searchText").val()==null||$("#searchText").val()==''){
				return false;
			}
		}
		function getWeather(){
			if($("#cityName").val()==null||$("#cityName").val()==''){
				return false;
			}
			var datas = {'cityName':$('#cityName').val()};
			$.ajax({
		  		'type':'post',
		  		'url':'${path }/developer/jiasnhu/showWeather',
		  		'data':datas,
		  		'dataType':'json',
		  		'success':function(data,status){
		  			$("#weatherContent").empty(); 
		  			$("#weatherContent").append(data.info);
		  		}
		  	}); 
		}
		
		function getMobileCode(){
			if($("#mobileCode").val()==null||$("#mobileCode").val()==''){
				return false;
			}
			var datas = {'mobileCode':$('#mobileCode').val()};
			$.ajax({
		  		'type':'post',
		  		'url':'${path }/developer/jiasnhu/showMobileCodeInfo',
		  		'data':datas,
		  		'dataType':'json',
		  		'success':function(data,status){
		  			$("#weatherContent").empty(); 
		  			$("#weatherContent").append(data.info);
		  		}
		  	}); 
		}
		</script>
	</body>
</html>
